<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=EDGE"/>
  <meta charset="UTF-8">
  <title>Get Fields Dialog</title>
  <!-- Requesting webcontext.js one level above to workaround the filter on PDI issue (BACKLOG-17885) -->
  <!-- Remove '../' when not needed -->
  <script type="text/javascript" src="../webcontext.js?requireJsOnly=true"></script>
  <link rel="stylesheet" type="text/css" href="css/index.css">
  <script>
    (function () {
      "use strict";

      // overrides just for this app
      var basePath = "";
      if ( IS_RUNNING_ON_WEBSPOON_MODE ) {
        basePath = "../..";
      }

      //add stylesheets
      var stylesheet1 = document.createElement('link');
      stylesheet1.rel = "stylesheet";
      stylesheet1.type = "text/css";
      stylesheet1.href = basePath + "/@pentaho/di-core-ui@${project.version}/css/fonts/opensans/style.css";
      document.head.appendChild(stylesheet1);
      var stylesheet2 = document.createElement('link');
      stylesheet2.rel = "stylesheet";
      stylesheet2.type = "text/css";
      stylesheet2.href = basePath + "/@pentaho/di-core-ui@${project.version}/css/global.css";
      document.head.appendChild(stylesheet2);

      require.config({
        paths: {
          "pentaho": basePath + "/@pentaho/di-core-ui@${project.version}/pentaho",
          "css": basePath + "/require-css@${require-css.version}/css",
          "text": basePath + "/requirejs-text@${requirejs-text.version}/text",
          "dojo": basePath + "/dojo@${dojo.version}"
        }
      });

      require(["pentaho/di/plugin/getFields"], function (app) {
        app.bootstrap(document);
      });
    }(window));
  </script>
</head>
<body>
  <script>
    (function() {
      var stopEvents = function(event) {
        event.preventDefault();
        event.stopPropagation();
        return false;
      };

      /*
       * Block context menu event
       */
      document.body.addEventListener("contextmenu", function(event) {
        if(event.srcElement.tagName !== "INPUT") {
          return stopEvents(event);
        }
      });

      /*
       * Block mousedown if user has shift pressed
       */
      document.body.addEventListener("mousedown", function(event) {
        if(event.shiftKey) {
          return stopEvents(event);
        }
      });

      /*
       * Block zoom and mouse navigation events
       */
      document.body.addEventListener("wheel", function(event) {
        if (event.ctrlKey || event.shiftKey) {
          return stopEvents(event);
        }
      });

      /**
       * Block some key down events to navigation, reload and zoom content
       */
      document.body.addEventListener("keydown", function(event) {
        var arrowNavigation = (event.altKey || event.metaKey) && (event.keyCode === 37 || event.keyCode === 39); // ALT+left arrow; ALT+right arrow; cmd+left arrow; cmd+right arrow
        var backNavigation = event.shiftKey && event.keyCode === 8 ||
          event.keyCode === 8 && event.srcElement.tagName !== "INPUT"; // backspace (except input/textarea tags); SHIFT+backspace
        var reloadContent = event.ctrlKey && event.keyCode === 116 || (event.ctrlKey || event.metaKey) && event.keyCode === 82 || event.keyCode === 116; // CTRL+F5; CTRL+r; cmd+r; F5
        var zoomContent = event.ctrlKey && (event.keyCode === 107 || event.keyCode === 109 || event.keyCode === 187 || event.keyCode === 189); // CTRL++; CTRL+-

        if (arrowNavigation || backNavigation || reloadContent || zoomContent) {
          return stopEvents(event);
        }
      });
    })();
  </script>
  <get-fields-app></get-fields-app>
</body>
</html>
